<style>
    .custom-orden-buttons{float: left; width: 500px; margin-left: 10px}
    .peditorden{float: left; width: 480px; margin-left: 15px; margin-right: 15px;}
    .peditorden span.value{font-style: italic;}
    .peditorden span.key{font-weight: bold;}
</style>
<article class="module width_full">
    <header><h3>Editar orden </h3></header>
    <div class="module_content">
        <form id="custom-orden" method="POST" action="<?php echo $this->url(); ?>">
            <fieldset title="Detalle de Orden">
                <legend style="display: none;">Titulo - Descripci&oacute;n - Fechas</legend>
                <p class="peditorden">
                    <span class="key">Codigo:</span>
                    <span class="value" id="code"><?php echo $this->orden->code ?></span>
                </p>
                <p class="peditorden">
                    <span class="key">Titulo:</span>
                    <span class="value" id="title"><?php echo $this->orden->title ?></span>
                </p>
                <p class="peditorden">
                    <span class="key">Descripci&oacute;n:</span>
                    <span class="value" id="description"><?php echo $this->orden->description; ?></span>
                </p>
                <p class="peditorden">
                    <span class="key">Fecha de inicio:</span>
                    <span class="value" id="create_date"><?php echo $this->orden->create_date; ?></span>
                </p>
                <p class="peditorden">
                    <span class="key">Fecha limite:</span>
                    <span class="value" id="end_date"><?php echo $this->orden->end_date; ?></span>
                </p>
                <p class="peditorden">
                    <span class="key">Estado Orden:</span>
                    <input class="rstatus" type="radio" name="radio_status" value="1" <?php echo ($this->orden->status == 1) ? 'checked="checked"' : '' ?>/> Aceptar
                    <input class="rstatus" type="radio" name="radio_status" value="4" <?php echo ($this->orden->status == 4) ? 'checked="checked"' : '' ?>/> Rechazar
                </p>
                <p class="peditorden">
                    <textarea name="deny_description" id="deny_description" rows="5" cols="60" style="display: none"><?php echo $this->orden->deny_description ?></textarea>
                </p>
            </fieldset>

            <input type="submit" class="finish" value="Modificar Orden" />
        </form>
    </div>
    <footer></footer>
</article>

<script language="javascript">
    $('#custom-orden').stepy({
        backLabel:	'Atras',
        block:		true,
        errorImage:	true,
        nextLabel:	'Siguiente',
        titleClick:	true,
        validate:	true
    });
    
    $('#custom-orden').validate({
        errorPlacement: function(error, element) {
            $('#custom-orden div.stepy-error').append(error);
        }, rules: {
            deny_description: { required: ".rstatus:checked" }
        }, messages: {
            'deny_description':	{ required: '*Ingrese una decripcion para aceptar/rechazar la orden' }
        }
    });
   
    $('.custom-orden-buttons').append('<a class="button" href="<?php echo $this->url(array('action' => 'index', 'id' => null)) ?>">Cerrar</a>');
    $('.rstatus').change(function(){
        if ($(this).attr("checked")) {
            $('#deny_description').show();
        }else{
            $('#deny_description').hide();
        }
    });
    if($('.rstatus').attr("checked")){
        $('#deny_description').show();
    }
</script>